//
//  YNTextField.m
//  HiCar
//
//  Created by 丁一 on 2019/1/8.
//  Copyright © 2019 丁一. All rights reserved.
//

#import "YNTextField.h"

@implementation YNTextField

- (void)deleteBackward {
    
    [super deleteBackward];
    
    if ([self.yn_delegate respondsToSelector:@selector(ynTextFieldDeleteBackward:)]) {
        [self.yn_delegate ynTextFieldDeleteBackward:self];
    }
}

- (BOOL)keyboardInputShouldDelete:(YNTextField *)textField
{
    BOOL shouldDelete =YES;
    if ([YNTextField instancesRespondToSelector:_cmd])
    {
        BOOL (*keyboardInputShouldDelete)(id,SEL,UITextField *) = (BOOL (*)(id,SEL,UITextField *))[UITextField instanceMethodForSelector:_cmd];
        if (keyboardInputShouldDelete)
        {
            shouldDelete = keyboardInputShouldDelete(self,_cmd, textField);
        }
    }
    if ([[[UIDevice currentDevice]systemVersion]intValue] >=8)
    {
        [self deleteBackward];
    }
    return shouldDelete;
}

@end
